=over

=item rand EXPR
X<rand> X<random>

=item rand

Returns a random fractional number greater than or equal to C<0> and less
than the value of EXPR.  (EXPR should be positive.)  If EXPR is
omitted, the value C<1> is used.  Currently EXPR with the value C<0> is
also special-cased as C<1> (this was undocumented before Perl 5.8.0
and is subject to change in future versions of Perl).  Automatically calls
L<C<srand>|/srand EXPR> unless L<C<srand>|/srand EXPR> has already been
called.  See also L<C<srand>|/srand EXPR>.

Apply L<C<int>|/int EXPR> to the value returned by L<C<rand>|/rand EXPR>
if you want random integers instead of random fractional numbers.  For
example,

    int(rand(10))

returns a random integer between C<0> and C<9>, inclusive.

(Note: If your rand function consistently returns numbers that are too
large or too small, then your version of Perl was probably compiled
with the wrong number of RANDBITS.)

B<L<C<rand>|/rand EXPR> is not cryptographically secure.  You should not rely
on it in security-sensitive situations.>  As of this writing, a
number of third-party CPAN modules offer random number generators
intended by their authors to be cryptographically secure,
including: L<Data::Entropy>, L<Crypt::Random>, L<Math::Random::Secure>,
and L<Math::TrulyRandom>.

=back